home *** CD-ROM | disk | FTP | other *** search
/ SunSoft Catalyst CDWARE 1996 May to August / Catalyst CDWARE 1996 May to August.iso / .products / .bin / httpd / Solaris_2 / pure-comment-mailer.pl < prev    next >
Perl Script  |  1995-09-26  |  2KB  |  78 lines

  1. #!./perl -- -*-perl-*-
  2.  
  3. # ------------------------------------------------------------
  4.  
  5. # Form-mail.pl, by Reuven M. Lerner (reuven@the-tech.mit.edu).
  6. # This is a rewrite of a program that was trashed by our power
  7. # surge in the middle of February 1994.
  8.  
  9. # ------------------------------------------------------------
  10.  
  11. # Bugs and other fixes
  12.  
  13. # March 1, 1994 (Reuven)
  14. # Fixed security hole that could result from people
  15. # executing subshells
  16. # January 5, 1995 (McGredy)
  17. # Modified for Pure Software, Inc.
  18. # ------------------------------------------------------------
  19.  
  20. # Define fairly-constants
  21. $mailprog = '/usr/ucb/mail -s "PS Web Comment"';
  22. # Ric: Change this to "support@pure.com" when it goes to Test
  23. # Ric: Change this to "ricm@rahul.net" when installed on rahul or mnl
  24. $recipient = 'ricm@rahul.net, info-home@pure.com';
  25.  
  26. # Print out what we need
  27. print "Content-type: text/html\n\n";
  28. print "<img src=/pure/logo.gif>";
  29. print "<p><hr><p>";
  30. print "<Head><Title>Thank You</Title></Head>";
  31. print "<Body><H1>Thank you for your comments.</H1>";
  32.  
  33. # Get the input
  34. read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
  35.  
  36. # Split the name-value pairs
  37. @pairs = split(/&/, $buffer);
  38.  
  39. foreach $pair (@pairs)
  40. {
  41.     ($name, $value) = split(/=/, $pair);
  42.     $value =~ tr/+/ /;
  43.     $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  44.  
  45.     # Stop people from using subshells to execute commands
  46.     $value =~ s/~!/ ~!/g;
  47.  
  48.     # Uncomment for debugging purposes
  49.     # print "Setting $name to $value<P>";
  50.  
  51.     $FORM{$name} = $value;
  52. }
  53.  
  54. # Now send mail to $recipient
  55.  
  56. open (MAIL, "|$mailprog $recipient") || die "Can't open $mailprog!\n";
  57. print MAIL "$FORM{'username'}, ($FORM{'realname'}, $FORM{'phonenum'}) sent the 
  58. \
  59. n";
  60. print MAIL "following comment about the Pure Software Web pages:\n\n";
  61. print MAIL  "------------------------------------------------------------\n\n";
  62. print MAIL "$FORM{'comments'}\n";
  63. print MAIL 
  64. "\n------------------------------------------------------------\n\n";
  65. print MAIL "Remote host: $ENV{'REMOTE_HOST'}\n";
  66. print MAIL "Remote IP address: $ENV{'REMOTE_ADDR'}\n";
  67. close (MAIL);
  68.  
  69.  
  70. print "<P>";
  71. print "<ul><li>Return to the <A HREF=\"index.html\">Pure Software Inc. Home 
  72. Page
  73.  </A>, if you want.</ul><P><hr>";
  74. print "<p>Your comments have been forwarded to the Customer Support department 
  75. (
  76. <code>support@pure.com</code>) at Pure Software Inc.";
  77.  
  78.